/**
 * Main entry point for the customize demo.
 */

/** Create a <br> in the buttons div. */
function br(b) {
  $n('br',$('buttons'));
  b.setNewline(true);
}

/**
 * Creates and returns a new button (mainly for demo-ing) with an image
 * icons/<icon>.png and name.
 *
 * @param icon src of the image to use
 * @param name [optional] name of the button, if null we use 'icon'
 * @return new button created from input
 */
function createButton(icon,name,absolute)  {
  if (!name) name = icon;
  var image = 'http://jeffpalm.com/iwebapp/icons/' + icon + '.png';
  return newButtonInstance(image,name,absolute);
}

function createDemoButtons() {
  
  function n(a,b) {
    var b = createButton(a,b);
    b.show();
    return b;
  }

  n('Safari','Browser');
  n('Calendar');
  br(n('Stocks'));

  n('Maps');
  n('Photos');
  br(n('Notes','Reader'));

  n('YouTube');
  n('Mail');
  br(n('Weather'));
}

function newButton() {
  var b = createButton('Settings','Nothing',true);
  b.setCoords(10,10);
  b.reposition();
  b.show();
}

function demo() {
  createDemoButtons();
}
